package com.yidu.best.TA.Fundinventory.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.yidu.best.TA.Fundinventory.domain.Fundinventory;
import com.yidu.best.TA.Fundinventory.domain.FundinventoryVo;
import com.yidu.best.TA.Fundinventory.service.FundinventoryService;

@Controller
@RequestMapping("/sys/")
public class FundinventoryController {
	@Autowired
	private FundinventoryService fundinventoryService;

	@RequestMapping("RevenueMap")
	public String RevenueMap() {
		return "/sys/Ta/Revenue";
	}

	@ResponseBody
	@RequestMapping(value = "Fundinventorys")
	public Map<String, Object> findFundinventory(FundinventoryVo fundinventoryVo) {
		return fundinventoryService.findFundinventory(fundinventoryVo);
	}

	@ResponseBody
	@RequestMapping(value = "finds")
	public Map<String, Object> find(String fundinventory) {
		return fundinventoryService.find(fundinventory);
	}

	@ResponseBody
	@RequestMapping(value = "insert")
	public String insertCashinventory(@RequestBody Fundinventory fundinventory) {
		int i = 0;
		i += fundinventoryService.insertCashinventory(fundinventory);
		if (i > 0) {
			fundinventoryService.insertCashinventoryinventory(fundinventory);
			return "结算完成";
		}
		return "结算失败";
	}

	@ResponseBody
	@RequestMapping(value = "addF")
	public String addcasharap(@RequestBody Fundinventory fundinventory) {
		int i = 0;
		i += fundinventoryService.addcasharap(fundinventory);
		if (i > 0) {
			fundinventoryService.addcasharapinventory(fundinventory);
			return "结算完成";
		}
		return "结算失败";
	}
}
